#ifndef LIBACCENT_UTILITY_SAFE_POSITION_HPP
#define LIBACCENT_UTILITY_SAFE_POSITION_HPP

#include <utility>

namespace accent
{
  namespace support
  {
    namespace detail
    {
      template <typename Range>
      typename Range::position safe_position_helper(Range);
      struct no_position_available {};
      no_position_available safe_position_helper(...);
    }

    template <typename Range>
    using safe_position =
        decltype(detail::safe_position_helper(std::declval<Range>()));
  }
}

#endif
